﻿<%@ Page Title="Master Data Activity" Language="C#" MasterPageFile="~/NPS/app/MasterData/masterdata.master" AutoEventWireup="true" CodeFile="TypeMaster.aspx.cs" Inherits="NPS_app_MasterData_TypeMaster" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.2" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<asp:Content ContentPlaceHolderID="Back" runat="server">
    <a class="backbutton" href="../../Default.aspx" data-bind="click: closeApp">
        <img src="../../img/Left.png" />
    </a>
</asp:Content>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="../../js/jquery.jgrowl.js"></script>
        <link rel="stylesheet" href="../../css/jquery.jgrowl.css">
    <script type="text/javascript">
        function numericFilter(txb) {
            txb.value = txb.value.replace(/[^\0-9]/ig, "");
        }

        function validateSave() {
            var returner = true;

            var x = $('#<%= txtCTitle.ClientID %>').val();
            if (x == "" || x == null) {
                returner = false;
                $.jGrowl("Title belum di masukkan", { position: 'bottom-left' });
            }
            
            if (returner) {
                return confirm("Apakah anda yakin untuk menyimpan item in?");
            } else return returner;
        }

        function validateEdit() {
            var returner = true;

            var x = $('#<%= txtETitle.ClientID %>').val();
            if (x == "" || x == null) {
                returner = false;
                $.jGrowl("Title belum di masukkan", { position: 'bottom-left' });
            }
            
            if (returner) {
                return confirm('Apakah anda yakin untuk menyimpan perubahan item ini?');
            } else return returner;
        }
    </script>
</asp:Content>
<asp:Content ContentPlaceHolderID="Header" runat="server">
    <asp:Literal ID="ltrTitle" runat="server"></asp:Literal>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
    <div id="body">
        <div class="container metro">            
            <form class="metro-form" runat="server" id="MasterData">
            <asp:HiddenField ID="hfID" runat="server" />
                <asp:Panel ID="pnlView" runat="server" DefaultButton="btnFilter">
                    <asp:Button ID="btnCreate" OnClick="btnCreate_Click" runat="server" CssClass="metro-button" Text="Create New" /><br/><br/>                      
                    <dxwgv:ASPxGridView ID="GridView1" KeyFieldName="iID" ClientInstanceName="dgView_c"
                    runat="server" AutoGenerateColumns="false"  Font-Size="Small" 
                    Settings-ShowTitlePanel="true" OnRowCommand="gv_RowCommand" >
                    <Styles Header-HorizontalAlign="Center" AlternatingRow-Enabled="True" Cell-Wrap="true"
                        Cell-Font-Size="Smaller" Header-Wrap="true" Header-Font-Size="Smaller" Header-Font-Bold="true"
                        Cell-ForeColor="Black">

                        <AlternatingRow Enabled="True">
                        </AlternatingRow>
                        <Cell Wrap="True" Font-Size="Smaller">
                        </Cell>
                    </Styles>
                    <SettingsPager PageSize="10">
                    </SettingsPager>
                    <Settings ShowFilterBar="Visible" ShowFilterRow="true" ShowFilterRowMenu="true" />
                    <SettingsBehavior AllowSort="true" />
                    <Columns>
                        <dxwgv:GridViewDataTextColumn Width="10%" FieldName="iID" Name="iID" Caption="ID">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn FieldName="sxTitle" Name="sxTitle" Caption="Title">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn  Width="0px">
                            <DataItemTemplate>
                                <asp:LinkButton ID="imbEdit" runat="server" CommandName="Editing" CommandArgument='<%# Eval("iID") %>' Text="Edit"
                                    ClientIDMode="Static" />
                            </DataItemTemplate>
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn  Width="0px">
                            <DataItemTemplate>
                                <asp:LinkButton ID="imbDetails" runat="server" CommandName="Details" CommandArgument='<%# Eval("iID") %>' Text="Detail"
                                    ClientIDMode="Static" />
                            </DataItemTemplate>
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn   Width="0px">
                            <DataItemTemplate>
                                <asp:LinkButton ID="imbDelet" runat="server" CommandName="Deleting" CommandArgument='<%# Eval("iID") %>' Text="Delete"
                                    ClientIDMode="Static" />
                            </DataItemTemplate>
                        </dxwgv:GridViewDataTextColumn>
                    </Columns>
                    <Settings ShowFooter="True" />
                </dxwgv:ASPxGridView>
                </asp:Panel> 
                
                <asp:Panel ID="pnlCreate" runat="server"  DefaultButton="btnCSave">
                    <div class="metro-form-control" style="width: 300px">
                        <label>Title</label>
                        <div class="metro-text-box">
                            <asp:TextBox ID="txtCTitle" runat="server" ></asp:TextBox>
                        </div>
                    </div>
                
                   
                    <asp:Button ID="btnCSave" OnClick="btnCSave_Click" runat="server" CssClass="metro-button" Text="Simpan"  OnClientClick=" return validateSave()" /> &nbsp;
                    <asp:Button ID="btnCCancel" OnClick="btnCCancel_Click" runat="server" CssClass="metro-button" Text="Batal" />
                </asp:Panel>
               
                <asp:Panel ID="pnlEdit" runat="server" DefaultButton="btnESave">
                    <div class="metro-form-control" style="width: 300px">
                        <label>Title</label>
                        <div class="metro-text-box">
                            <asp:TextBox ID="txtETitle" runat="server" ></asp:TextBox>
                        </div>
                    </div>
                 
                    
                    <asp:Button ID="btnESave" OnClick="btnESave_Click" runat="server" CssClass="metro-button" Text="Simpan" OnClientClick="return validateEdit()" /> &nbsp;
                    <asp:Button ID="btnECancel" OnClick="btnECancel_Click" runat="server" CssClass="metro-button" Text="Batal" />                
                </asp:Panel>
                
                <asp:Panel ID="pnlDetails" runat="server" DefaultButton="btnDEdit">                    
                    <div class="metro-form-control" style="width: 300px">                        
                        <div class="metro-text-box">
                            <table>
                                <tr>
                                    <td>ID</td>
                                    <td>&nbsp; : </td>
                                    <td><asp:Label ID="lblDID" runat="server"></asp:Label></td>
                                </tr>
                                <tr>
                                    <td>Title</td>
                                    <td>&nbsp; : </td>
                                    <td><asp:Label ID="lblDT" runat="server"></asp:Label></td>
                                </tr>
                               
                               
                            </table>
                        </div>
                    </div>
                    
                    <asp:Button ID="btnDEdit" OnClick="btnDEdit_Click" runat="server" CssClass="metro-button" Text="Edit" /> &nbsp;
                    <asp:Button ID="btnDBack" OnClick="btnDBack_Click" runat="server" CssClass="metro-button" Text="Back to List" />   
                </asp:Panel>
                
                <asp:Panel ID="pnlDelete" runat="server"  DefaultButton="btnDelete">
                <div class="metro-form-control" style="width: 300px">                        
                        <div class="metro-text-box">
                            <table>
                                <tr>
                                    <td>ID</td>
                                    <td>&nbsp; : </td>
                                    <td><asp:Label ID="lblID" runat="server"></asp:Label></td>
                                </tr>
                                <tr>
                                    <td>Title</td>
                                    <td>&nbsp; : </td>
                                    <td><asp:Label ID="lblT" runat="server"></asp:Label></td>
                                </tr>
                            
                            </table>
                        </div>
                    </div>
                    
                    <asp:Button ID="btnDelete" OnClick="btnDelete_Click" runat="server" CssClass="metro-button" Text="Delete" OnClientClick="return confirm('Apakah anda yakin untuk menghapus item ini?');" /> &nbsp;
                    <asp:Button ID="btnBack" OnClick="btnBack_Click" runat="server" CssClass="metro-button" Text="Back to List" />  
                </asp:Panel>
            </form>
        </div>
    </div>
</asp:Content>
